Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc

hardwired configuration loader

  • 0.5.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18M
decreased by-4.37%
Maintainers
1
Weekly downloads
 
Created

What is rc?

The rc npm package is a configuration loader for Node.js applications. It allows you to configure your applications with files, environment variables, and command-line arguments. This package is particularly useful for creating flexible applications that can be easily configured without changing the codebase.

What are rc's main functionalities?

Loading configuration from a file

This feature allows you to load configuration for your application named 'appname' from a file. If the file does not exist, it falls back to the default configuration provided.

const config = require('rc')('appname', { defaultConfig: 'defaultValue' });

Overriding configuration with environment variables

This demonstrates how to override a specific configuration option ('configOption') for 'appname' using an environment variable. The environment variable takes precedence over the default value.

process.env.appname_configOption = 'newValue';
const config = require('rc')('appname', { configOption: 'defaultValue' });

Using command-line arguments to override configuration

This example shows how command-line arguments can be used to override the configuration in 'appname'. The command-line argument '--configOption newValue' overrides the default configuration.

// Run the application with: node app.js --configOption newValue
const config = require('rc')('appname', { configOption: 'defaultValue' });

Other packages similar to rc

Keywords

FAQs

Package last updated on 04 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc